package com.demo.app;

import java.util.ArrayList;
import java.util.List;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.demo.app.test.SignActivity;
import com.demo.app.test.TestWidgetActivity;
import com.demo.framework.ui.BaseActivity;

public class MainActivity extends BaseActivity {

    ListView listView = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        listView = new ListView(this);
        listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, getData()));
        setContentView(listView);

        listView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
                // TODO Auto-generated method stub
                if (position == 0) {
                    Intent intent = new Intent();
                    intent.setClass(MainActivity.this, TestWidgetActivity.class);
                    startActivity(intent);
                }
                else if(position == 1){
                    Intent intent = new Intent();
                    intent.setClass(MainActivity.this, SignActivity.class);
                    startActivity(intent);
                }
            }
        });
    }
    

    private List<String> getData() {
        List<String> data = new ArrayList<String>();
        data.add("常用的控件");
        data.add("签名");
        data.add("loading");
        data.add("sqlite");
        data.add("http connection");
        data.add("location");

        return data;
    }


    @Override
    protected void setupView() {
        // TODO Auto-generated method stub
        
    }

}
